package com.atguigu.tingshu.account.service;

import com.atguigu.tingshu.model.account.RechargeInfo;
import com.atguigu.tingshu.model.account.UserAccount;
import com.atguigu.tingshu.model.account.UserAccountDetail;
import com.atguigu.tingshu.vo.account.AccountLockResultVo;
import com.atguigu.tingshu.vo.account.AccountLockVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;

import java.math.BigDecimal;

public interface UserAccountService extends IService<UserAccount> {

    /**
     * 初始化账户信息.
     * @param userId
     */
    void addUserAccount(Long userId);

    /**
     * 查询账户可用余额
     * @param userId
     * @return
     */
    BigDecimal getAvailableAmount(Long userId);

    /**
     * 检查与锁定
     * @param accountLockVo
     * @return
     */
    AccountLockResultVo checkAndLock(AccountLockVo accountLockVo);

    /**
     * 扣减金额;
     * @param orderNo
     */
    void minus(String orderNo);

    /**
     * 解锁金额;
     * @param orderNo
     */
    void unlock(String orderNo);

    /**
     * 充值成功
     * @param orderNo
     */
    void rechargePaySuccess(String orderNo);

    /**
     * 查看充值记录
     * @param userAccountDetailPage
     * @param userId
     * @return
     */
    IPage<UserAccountDetail> findUserRechargePage(Page<UserAccountDetail> userAccountDetailPage, Long userId);

    /**
     * 查看消费记录
     * @param userAccountDetailPage
     * @param userId
     * @return
     */
    IPage<UserAccountDetail> findUserConsumePage(Page<UserAccountDetail> userAccountDetailPage, Long userId);
}
